home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _GETCBRK.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  77 lines

  1. #define        CURSES_LIBRARY  1
  2. #define NEEDS_OS2       1
  3. #include <curses.h>
  4.  
  5. #ifndef        NDEBUG
  6. char *rcsid__getcbrk = "$Header: c:/curses/private/RCS/_getcbrk.c%v 2.0 1992/11/15 03:24:20 MH Rel $";
  7. #endif
  8.  
  9. #ifdef OS2
  10. #  if defined(CURSES__32BIT__) || defined (CSET2)
  11. #     include <signal.h>
  12. #  else
  13. #     define INCL_DOSSIGNALS
  14. #     define INCL_NOCOMMON
  15. #     include <bsedos.h>
  16. #  endif
  17. #endif
  18.  
  19.  
  20. /*man-start*********************************************************************
  21.  
  22.   PDC_get_ctrl_break() - return OS control break state
  23.  
  24.   PDCurses Description:
  25.        This is a private PDCurses routine.
  26.  
  27.        Returns the current OS Control Break Check state.
  28.  
  29.   PDCurses Return Value:
  30.        DOS:
  31.                This function returns TRUE on if the Control Break
  32.                Check is enabled otherwise FALSE is returned.
  33.  
  34.        FLEXOS:
  35.                This function returns TRUE on if the Keyboard Mode
  36.                allows a break to bre reported otherwise FALSE is returned.
  37.  
  38.   PDCurses Errors:
  39.        No errors are defined for this function.
  40.  
  41.   Portability:
  42.        PDCurses        bool    PDC_get_ctrl_break( void );
  43.  
  44. **man-end**********************************************************************/
  45.  
  46. bool   PDC_get_ctrl_break(void)
  47. {
  48. #ifdef FLEXOS
  49.        return ((kbmode & 0x01) ? TRUE : FALSE);
  50. #endif
  51. #ifdef DOS
  52.        regs.h.ah = 0x33;
  53.        regs.h.al = 0x00;
  54.        int86(0x21, ®s, ®s);
  55.        return ((bool) regs.h.dl);
  56. #endif
  57. #ifdef OS2
  58. #  if defined(CURSES__32BIT__) || defined(CSET2)
  59.        void (*oldAction) (int);
  60.        oldAction = signal (SIGINT, SIG_DFL);
  61.        if (oldAction == SIG_ERR) return FALSE;
  62.        else signal (SIGINT, oldAction);
  63.        return (oldAction != SIG_IGN);
  64. #  else
  65.        PFNSIGHANDLER oldHandler, oldHandler1;
  66.        USHORT oldAction, oldAction1;
  67.        /* get the current state, and set to ignore */
  68.        DosSetSigHandler((PFNSIGHANDLER) NULL, &oldHandler, &oldAction,
  69.                SIGA_IGNORE, SIG_CTRLBREAK);
  70.        /* restore the previous state */
  71.        DosSetSigHandler(oldHandler, &oldHandler1, &oldAction1,
  72.                oldAction, SIG_CTRLBREAK);
  73.        return(oldAction != SIGA_IGNORE);
  74. #  endif
  75. #endif
  76. }
  77.